<script lang="ts" setup>
import { toRaw } from 'vue';
import { reviewStore } from '../stores/review'
import router from '@/router';
import { informationStore } from '../stores/information'

let revSto:any = toRaw(reviewStore().$state.review);
console.log(revSto);

let goPage:any = (path:any , pid:any) => {
    router.push({path , query: {pid}});
}

let informa = informationStore().$state.information;

</script>


<template>
    <div class="RemarkView">
        <div class="RemarkView-Header">
            <van-nav-bar title="我的评论" left-arrow @click-left="$router.back()" />
        </div>
        <div class="RemarkView-Body">
            <div class="RemarkBox">
                <div class="Remark-item" v-for="(item , index) in revSto" :key="index" @click="goPage('/detail' , item.pid)">
                    <div class="User-iconBox">
                        <img :src="informa.toux.content || informa.toux">
                    </div>
                    <div class="item-com">
                        <h3 class="item-title one-txt-cut">{{informa.nic}}</h3>
                        <!-- <span>好好住编辑部</span> -->
                        <p class="comment">{{ item.revie }}</p>
                    </div>
                    <div class="item-imgBox">
                        <img :src="item.pic">
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<style lang="scss" scoped>
.RemarkView {
    min-height: 100vh;
    background: #f5f5f5;

    .RemarkView-Header {
        .van-nav-bar::v-deep {
            .van-nav-bar__content {
                height: 35px;

                .van-nav-bar__left {
                    i {
                        font-size: 18px;
                        color: #000;
                    }
                }

                .van-nav-bar__title {
                    font-weight: normal;
                }
            }

        }
    }

    .Remark-item {
        display: flex;
        height: 106px;
        // align-items: center;
        border-bottom: 1px solid #c3c3c3;
        box-sizing: border-box;
        padding: 15px;
        background: #fff;

        .User-iconBox {
            width: 40px;
            flex-shrink: 0;
            height: 40px;
            margin-right: 10px;
            overflow: hidden;
            border-radius: 50%;
        }

        .item-com {
            display: flex;
            flex: 1;
            flex-direction: column;
            height: 100%;
            justify-content: space-around;
            margin-right: 20px;
            overflow: hidden;

            h3 {
                font-size: 16px;
                word-wrap: break-word;
                word-break: break-all;
            }

            span {
                font-size: 12px;
                color: #999;
                transform: scale(0.9);
                transform-origin: left;
            }
        }

        .item-imgBox {
            width: 44px;
            height: 44px;
            flex-shrink: 0;
            overflow: hidden;
            border-radius: 4px;

            img {
                object-fit: cover;
            }
        }
    }
}
</style>